package com.stylefeng.guns.modular.netcar.warpper;

import com.stylefeng.guns.core.base.warpper.BaseControllerWarpper;
import com.stylefeng.guns.core.common.constant.state.ServiceType;
import com.stylefeng.guns.core.util.SpringContextHolder;
import com.stylefeng.guns.modular.netcar.dao.VehiclePriceTypeMapper;
import com.stylefeng.guns.modular.netcar.model.VehiclePriceType;
import org.apache.commons.lang3.StringUtils;

import java.util.Map;

/**
 * 部门列表的包装
 *
 * @author fengshuonan
 * @date 2017年4月25日 18:10:31
 */
public class LinePriceWarpper extends BaseControllerWarpper {
    
    private VehiclePriceTypeMapper vehiclePriceTypeMapper= SpringContextHolder.getBean(VehiclePriceTypeMapper.class);

    public LinePriceWarpper(Object list) {
        super(list);
    }

    @Override
    public void warpTheMap(Map<String, Object> map) {
        String vptCode= (String) map.get("vptCode");//车辆类型
        if(StringUtils.isNotBlank(vptCode)){
            VehiclePriceType v=new VehiclePriceType();
            v.setVptCode(vptCode);
            VehiclePriceType vehiclePriceType=this.vehiclePriceTypeMapper.selectOne(v);
            if(vehiclePriceType!=null){
            String vptCodeName=vehiclePriceType.getVptName();
            map.put("vptCodeName", vptCodeName);
            }
        }
      
        String serviceType= (String) map.get("serviceType"); //服务类型
        if(StringUtils.isNotBlank(serviceType)){
            map.put("serviceTypeName", ServiceType.valueOf(Integer.parseInt(serviceType)));
        }
        
       
      }

}
